<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Basic Form </title>

    <!-- ================= Favicon ================== -->

    <!-- Styles -->
    <link href="__VIS__/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/themify-icons.css" rel="stylesheet">
    <link href="__VIS__/css/lib/menubar/sidebar.css" rel="stylesheet">
    <link href="__VIS__/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/unix.css" rel="stylesheet">
    <link href="__VIS__/css/style.css" rel="stylesheet">
</head>

<body>
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-8 p-r-0 title-margin-right">
                    <div class="page-header">
                        <div class="page-title">
                            <h1>添加/编辑系统菜单</h1>
                        </div>
                    </div>
                </div>
                <!-- /# column -->
                <div class="col-lg-4 p-l-0 title-margin-left">
                    <div class="page-header">
                        <div class="page-title">
                            <ol class="breadcrumb text-right">
                                <li><a href="#">系统设置</a></li>
                                <li><a href="{:url('index')}">系统菜单</a></li>
                                <li class="active">添加/编辑系统菜单</li>
                            </ol>
                        </div>
                    </div>
                </div>
                <!-- /# column -->
            </div>
            <!-- /# row -->
            <section id="main-content">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card alert">
                            <div class="card-header">
                                <h4>添加/编辑系统菜单</h4>
                                <div class="card-header-right-icon">
                                    <ul>
                                        <li class="card-close" data-dismiss="alert"><i class="ti-close"></i></li>
                                        <li class="doc-link"><a href="#"><i class="ti-link"></i></a></li>
                                        <li class="page-refresh"><i class="fa fa-refresh"></i> 刷新页面</li>
                                    </ul>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="basic-elements">
                                    <form class="vis_form">
                                        <div class="row">
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label>上级菜单</label>
                                                    <select class="form-control" name="pid">
                                                        <option value="0">作为顶级菜单</option>
                                                        {volist name="$menus" id="vo"}
                                                        <option value="{$vo.id}" {notempty name="$menu.pid"}{eq name="$menu.pid" value="$vo.id"} selected=""{/eq}{else /}{notempty name="$pid"}{eq name="$pid" value="$vo.id"} selected=""{/eq}{/notempty}{/notempty}>{$vo.str}{$vo.name}</option>
                                                        {/volist}
                                                    </select>
                                                </div>
                                                <div class="form-group">
                                                <label>菜单排序</label>
                                                <input type="text" name="orders" class="form-control" placeholder="请输入" {notempty name="$menu.orders"}value="{$menu.orders}"{/notempty}>
                                                    <span class="help-block">
														<small>菜单排序，0为默认排序，由小到大 </small>
													</span>
                                                 </div>
                                                <div class="form-group">
                                                    <label>菜单名称</label>
                                                    <input type="text" name="name" class="form-control" placeholder="请输入" {notempty name="$menu.name"}value="{$menu.name}"{/notempty}>
                                                </div>
                                                <div class="form-group">
                                                    <label>描述</label>
                                                    <textarea class="form-control" rows="4" placeholder="Text input" name="description">{notempty name="$menu.description"}{$menu.description}{/notempty}</textarea>
                                                </div>
                                                <div class="form-group">
                                                    <label>类型</label>
                                                    <select class="form-control" name="type">
                                                        <option value="1" {notempty name="$menu.type"}{eq name="$menu.type" value="1"} selected=""{/eq}{/notempty}>权限节点</option>
                                                        <option value="2" {notempty name="$menu.type"}{eq name="$menu.type" value="2"} selected=""{/eq}{/notempty}>正常节点</option>
                                                    </select>
                                                </div>
                                                <div class="form-group">
                                                    <label>状态</label>
                                                    <select class="form-control" name="is_display">
                                                        <option value="1" {notempty name="$menu.is_display"}{eq name="$menu.is_display" value="1"} selected=""{/eq}{/notempty}>作为菜单显示</option>
                                                        <option value="2" {notempty name="$menu.is_display"}{eq name="$menu.is_display" value="2"} selected=""{/eq}{/notempty}>作为正常操作</option>
                                                    </select>
                                                </div>
                                                <div class="form-group">
                                                    <label>模块名</label>
                                                    <input type="text" name="module" class="form-control" placeholder="请输入" {notempty name="$menu.module"}value="{$menu.module}"{/notempty}>
                                                    <span class="help-block">
														<small>如果是作为顶级菜单，请留空</small>
													</span>
                                                </div>
                                                <div class="form-group">
                                                    <label>控制器</label>
                                                    <input type="text" name="controller" class="form-control" placeholder="请输入" {notempty name="$menu.controller"}value="{$menu.controller}"{/notempty}>
                                                    <span class="help-block">
														<small>如果是作为顶级菜单，请留空</small>
													</span>
                                                </div>
                                                <div class="form-group">
                                                    <label>方法</label>
                                                    <input type="text" name="function" class="form-control" placeholder="请输入" {notempty name="$menu.function"}value="{$menu.function}"{/notempty}>
                                                    <span class="help-block">
														<small>如果是作为顶级菜单，请留空</small>
													</span>
                                                </div>
                                                <div class="form-group">
                                                    <label>附加参数</label>
                                                    <input type="text" name="parameter" class="form-control" placeholder="请输入" {notempty name="$menu.parameter"}value="{$menu.parameter}"{/notempty}>
                                                    <span class="help-block">
														<small>请用'&'隔开，例如：id=617&name=yueqing</small>
													</span>
                                                </div>
                                                <div class="form-group">
                                                    <label>菜单图标</label>
                                                    <input type="text" name="icon" class="form-control" placeholder="请输入" {notempty name="$menu.icon"}value="{$menu.icon}"{/notempty}>
                                                    <span class="help-block">
														<small>例如：fa-refresh，图标参考：<a href="http://code.zoomla.cn/boot/font.html" target="_block">点击查看</a></small>
													</span>
                                                </div>
                                                <div class="form-group">
                                                        <div class="checkbox">
                                                            <label>
                                                                <input type="checkbox" name="is_open" value="1" {notempty name="$menu.is_open"}{eq name="$menu.is_open" value="1"}checked=""{/eq}{/notempty}> 默认展开
                                                            </label>
                                                        </div>
                                                </div>
                                                {notempty name="$menu"}
                                                <input type="hidden" name="id" value="{$menu.id}">
                                                {/notempty}
                                                <div class="form-group">
                                                    <a href="#" class="btn btn-default btn-outline vis_form_btn">立即提交</a>
                                                </div>
                                            </div>

                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /# column -->
                         <!-- /# column -->
                </div>
                <!-- /# row -->
            </section>
        </div>


<div id="search">
    <button type="button" class="close">×</button>
    <form>
        <input type="search" value="" placeholder="type keyword(s) here" />
        <button type="submit" class="btn btn-primary">Search</button>
    </form>
</div>
<!-- jquery vendor -->
<script src="__VIS__/js/lib/jquery.min.js"></script>
<script src="__VIS__/js/lib/jquery.nanoscroller.min.js"></script>
<!-- nano scroller -->
<script src="__VIS__/js/lib/menubar/sidebar.js"></script>
<script src="__VIS__/js/lib/preloader/pace.min.js"></script>
<!-- sidebar -->
<script src="__VIS__/js/lib/bootstrap.min.js"></script>
<!-- bootstrap -->
        <script src="__VIS__/js/layer/layer.js"></script>

<script src="__VIS__/js/scripts.js"></script>
<!-- scripit init-->
        <script>
            $('.page-refresh').on("click", function() {
                location.reload();
            });
            $('.vis_form_btn').click(function () {
                $.ajax({
                    url:"{:url('admin/auth/edit')}",
                    type:'POST',
                    dataType:'JSON',
                    data:$('.vis_form').serialize(),
                    success:function (res) {
                        if(res.code == 1){
                            layer.msg(res.msg,{icon:6},function () {
                                window.location.href=res.url;
                            })
                        }else {
                            layer.msg(res.msg,{icon:5})
                        }
                    }
                })
            })
        </script>




</body>

</html>